﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;

namespace JiaBoPrint
{
    public partial class main : Form
    {
        public main()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            沙驰评审会打印 frmList = new 沙驰评审会打印();
            frmList.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            诺贝达评审会打印 frmList = new 诺贝达评审会打印();
            frmList.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            诺贝达样衣打印 frmList = new 诺贝达样衣打印();
            frmList.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            诺贝达往季复盘打印 frmList = new 诺贝达往季复盘打印();
            frmList.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            沙驰评审会预投打印 frmList = new 沙驰评审会预投打印();
            frmList.Show();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            诺贝达订货会卖点打印 frmList = new 诺贝达订货会卖点打印();
            frmList.Show();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            沙驰订货会删单打印 frmList = new 沙驰订货会删单打印();
            frmList.Show();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            订货会直营订货数据 frmList = new 订货会直营订货数据();
            frmList.Show();
        }



        private void button9_Click(object sender, EventArgs e)
        {
            沙驰商品尺寸打印 frmList = new 沙驰商品尺寸打印();
            frmList.Show();
        }

        private void button10_Click(object sender, EventArgs e)
        {
            沙驰商品尺寸打印多 frmList = new 沙驰商品尺寸打印多();
            frmList.Show();
        }

        private void main_Load(object sender, EventArgs e)
        {
            //Process.Start(Application.StartupPath + "//UpdateProcess.exe");
            string fileName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
            Update(Application.StartupPath + "\\AutoUpdater.xml", "AutoUpdater/RestartApp/AppName", "Name", fileName);
        }
        /// <summary>
        /// 修改指定节点的属性值(静态)
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="node">节点</param>
        /// <param name="attribute">属性名，非空时修改该节点属性值，否则修改节点值</param>
        /// <param name="value">值</param>
        /// 使用示列:
        /// XMLProsess.Insert(path, "/Node", "", "Value")
        /// XMLProsess.Insert(path, "/Node", "Attribute", "Value")
        public void Update(string path, string node, string attribute, string value)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(path);
                XmlNode xn = doc.SelectSingleNode(node);
                XmlElement xe = (XmlElement)xn;
                if (attribute.Equals(""))
                    xe.InnerText = value;
                else
                    xe.SetAttribute(attribute, value);
                doc.Save(path);

                System.Diagnostics.Process.Start(Application.StartupPath + "\\UpdateProcess.exe",SqlHelper.ConnectionStringLocalTransaction);
            }
            catch { }
        }
    }
}
